<%include file="user_header.html"/>
<script>
// Last updated 2006-02-21
function addRowToTable()
{
  var tbl = document.getElementById('tblSample');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;
  var row = tbl.insertRow(lastRow);
  
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);
  
  // select cell
  var cellRightSel = row.insertCell(1);
  var sel = document.createElement('select');
  sel.name = 'selRow' + iteration;
  sel.options[0] = new Option('渣浪', 'sina');
  sel.options[1] = new Option('优酷', 'youku');
  sel.options[2] = new Option('flv链接', 'file');
  cellRightSel.appendChild(sel);

  // right cell
  var cellRight = row.insertCell(2);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'txtRow' + iteration;
  el.id = 'txtRow' + iteration;
  el.size = 40;
  
  cellRight.appendChild(el);

  var cellRight = row.insertCell(3);
  var el2 = document.createElement('input');
  el2.type = 'text';
  el2.name = 'ttlRow' + iteration;
  el2.id = 'ttlRow' + iteration;
  el2.size = 40;
  
  cellRight.appendChild(el2);
}
function removeRowFromTable()
{
  var tbl = document.getElementById('tblSample');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
</script>
<div class="content">
	<div class="dedeMain">
        <form class="mTB10 mL10 mR10" name="form1" action="/user/addvideo" method="post" enctype="multipart/form-data">
          <table cellspacing="1" class="submit">
            <thead>
              <tr>
                <th colspan="2" ><strong>视频信息</strong>：推荐直接去acfun或者bilibili投稿，实在通不过才在本站投稿。</th>
              </tr>
            </thead>

            <tbody>
              <tr>
                <td width="15%" align="right" valign="top">标题：</td>
                <td><input name="title" type="text" id="title" size="30" class="text" style="width:300px;" 
					value="${title}"/>
                  <span style="color:#F00">*</span></td>
              </tr>
              <tr>
                <td align="right" valign="top">作者：</td>
                <td><label type="text" name="writer" id="writer" size="30" class="text" />${nickname}</label></td>
              </tr>
              <tr>
                <td align="right" valign="top">隶属栏目：</td>
                <td><select name='cat' size='1'>
					<option value='0' selected>请选择栏目...</option>
				%for c in [u'动画',u'音乐',u'游戏',u'娱乐',u'番影']:
					%if c == category:
						<option value='${c}' class='option3' selected>${c}</option>
					%else:
						<option value='${c}' class='option3'>${c}</option>
					%endif
				%endfor
					</select>
					<span style="color:#F00">*</span>
				</td> 
  			</tr>
              <tr>
                <td align="right" valign="top">信息摘要：</td>
                <td><textarea name="description" id="description" style="height:50px;width:300px">${abstract}</textarea><font color="red"><br>视频的内容简介</font></td>
              </tr>
              <tr>
                <td align="right" valign="top">缩略图(120x90)：</td>

                <td><input class="file" name="litpic" type="file" id="litpic" style="width:408px" />
                  <div id='divpicview' class='divpre'></div>
				  </td>
              </tr>
              <input type='hidden' name='id' value="${id}">
              <tr>
                <td align="right" valign="top">详细内容：</td>
                <td>	  

				<table border="0" id="tblSample" class="bookcaseTable">
				  <tr>
				    <th>Part编号</th>
				    <th>视频来源</th>
				    <th>播放列表/视频地址</th>
				    <th>Part子标题(可留空)</th>
				  </tr>
				%if not parts:
				  <tr>
				    <td>1</td>
				    <td>
				    <select name="selRow1">
					    <option value="sina">渣浪</option>
				   	    <option value="youku">优酷</option>
			   	    <option value="file">flv链接</option>
				    </select>
				    </td>
				    <td><input type="text" name="txtRow1" id="txtRow1" size="40"/></td>
				    <td><input type="text" name="ttlRow1" id="ttlRow1" size="40"/></td>
				  </tr>
				%else:
					%for i in range(len(parts)):
				  <tr>
				    <td>${i+1}</td>
				    <td>
				    <select name="selRow${i+1}">
						%for k,v in {'sina':u'渣浪','youku':u'优酷','file':u'flv链接'}.items():
							%if k==parts[i][0]:
					    <option value="${k}" selected>${v}</option>
							%else:
				   	    <option value="${k}">${v}</option>
							%endif
						%endfor
				    </select>
				    </td>
				    <td><input type="text" name="txtRow${i+1}" id="txtRow${i+1}" size="40" value="${parts[i][1]}"/></td>
				    <td><input type="text" name="ttlRow${i+1}" id="ttlRow${i+1}" size="40" value="${parts[i][2]}"/></td>
				  </tr>
					%endfor
				%endif
				</table>
				<p>
				<input type="button" value="添加" onclick="addRowToTable();" />
				<input type="button" value="删除" onclick="removeRowFromTable();" />
				</p>
              </tr>
			<tr>
			<td></td>
			<td>
                <input type="submit" value="提交" style="margin-left:300px"/>
			</td></tr>
			</tbody>
          </table>
        </form>

      </div>
    
   <dl class="bookcaseIntro">
        <dt>小贴士：</dt>
        <dd>
            1) <em>新浪视频</em>只需输入<em>播客地址</em>：http://you.video.sina.com.cn/b/30627747-1442748650.html
		</dd>
        <dd>
            2) <em>优酷视频</em>只需输入<em>视频地址</em>: http://v.youku.com/v_show/id_XMTc1MDAwNjY4.html
		</dd>
        <dd>
            3) <em>优酷播放列表</em>需要输入分享一栏里面的<em>flash地址</em>: 
				http://player.youku.com/player.php/sid/XMTc1MDAwNjY4/v.swf
		</dd>
        <dd>
            4) 如果没有上传<em>缩略图</em>，则系统会<em>自动截取</em>视频起始<em>第2秒</em>的截图，没有截图的视频无法在封面图上显示。
		</dd>
    </dl> 
    <!--书架 end-->
	</div>
</div>
<%include file="user_footer.html"/>
